Numerical accuracy of uvcontsub2021

This notebook simulates MeasurementSets with known continuum shapes (for example, as polynomials of different order with known coefficients). It has functions to produce MSs including point sources, spectral lines, added noise, and polynomial continuum functions. These MSs can be used to test the numerical accuracy of the task uvcontsub2021, illustrate its usage and experiment with it under different simulated conditions.

Import required CASA tasks and tools, and other packages

Definition of simulation building blocks

This section defines function to:

Uses functions from https://github.com/urvashirau/Simulation-in-CASA/blob/master/Basic_Simulation_Demo/Simulation_Script_Demo.ipynb, adapted to this set of simulations for uvcontsub.

Simple MS with continuum, line, and noise, plotted step by step

Using order 0 continuum.

The structure of this MS is the one used at the moment in the task test (test_task_req_uvcontsub2021). nchan=128. The spectral line is added to channels 60-85. The value of the fitspw parameter for this MS structure would be '0:0~59;86~127'.

The following functions we produce MSs without adding polynomials to the real and imaginary part of the visibilities. These MSs can be used to test the behavior of the task with sources

Polynomial n=0 continuum

Polynomial n=1 continuum

Polynomial n=2 continuum

Polynomial n=3 continuum

uvcontsub

Each of the simulated meaurement files are background subtracted using uvcontsub

Average Plots

Average plots display the data spectrum vs channel averaged along the time/sample axis. Fit line show the fit line used by uvcontsub to subtract the background. Plots are shown for each polynomial order background.

polynomial n=0 continuum

Synopsis UVCONTSUB Plots and Statistics Figures

Synopsis plots show the uncorrected and corrected data spectrum plots. Each plot, spectrum vs channel, is averaged along the time/sample axis. A histogram of the corrected continuum background is displayed with a gaussian fit and statistics detailing the mean, stddev and skew to determine normality of the distribution. Finally, an interactive table with a detailed statistical comparison, using casatasks.visstat, is displayed to compare the spectrum statistics before and after uvcontsub.